﻿using Fozzy;
using Fozzy.Skin;
using System.Collections.Generic;
using System.Windows.Controls;
using System.Linq;

namespace Microsoft.FamilyShow
{
    public class Skins                                                      : Enumeration<Skin>
    {
        #region Declarations
        #endregion

        #region Structure
            private IEnumerable<Directory>  Directories                     { get { return new Directory(Module.Resources.Skins.Value).Subs             ; } }
            internal Fozzy.WPF.Menu         Menu                            { get { return new Fozzy.WPF.Menu(Instances.Select(skin => skin.Handler))  ; } }
        #endregion

        #region Properties
            public Skins()                                                  
            {}
        #endregion

            protected override void Prepare()
            {
                base.Prepare()                                              ;
                Enumerate()                                                 ;
            }

            private void Enumerate()
            {
                foreach (Directory dir in Directories) 
                    foreach (Fozzy.File file in dir.Files.Where(file => file.Extension == Module.Resources.Xaml_Extension.Value)) 
                        Add(new Skin(file))                                 ;
            }
    }

}
